package itheima.com.Utiley;

import org.junit.Test;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class inputStream_ {

    public static void main(String[] args) {



    }

    /**
     *
     */
    @Test
    public void FileInputSteam_(){

        String filePath = "D:\\一条小团团\\xiao.txt";
        int read = 0;
        FileInputStream fileInputStream = null;
        byte[] bytes = new byte[8];
        int readeLen = 0;

        try {
             fileInputStream = new FileInputStream(filePath);
//            System.out.println(file.read());
//            System.out.println("file.read()"+( file.read() != -1 ));

                while ((readeLen = fileInputStream.read(bytes)) != -1) {
                    System.out.print(new String(bytes, 0, readeLen));
//                    System.out.print((char) read);
//                    System.out.print("file.read()"+file.read());
                }

        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            try {
                fileInputStream.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }


    }

}
